package hku.cs.lunuo.rank;

import hku.cs.lunuo.rank.model.Label;

import org.jdom.Element;

public class StatisticProperty{
	public Label label = null;
	public TFTimes tfs = new TFTimes();
	
	
	public StatisticProperty(Label label, TFTimes tfs) {
		super();
		this.label = label;
		this.tfs = tfs;
	}


	public StatisticProperty() {
	}


	public void add(boolean b) {
		tfs.add(b);
	}
	
	public void merge(StatisticProperty sp){
		tfs.add(sp.tfs);
	}
	
	public void toXML(Element xml) {
		if(label!=null)
			label.toXML(xml);
		
		Element xtf = new Element("tftimes");
		xtf.setAttribute("true", String.valueOf(tfs.getTruTimes()));
		xtf.setAttribute("false", String.valueOf(tfs.getFlsTimes()));		
		xml.addContent(xtf);
	}
	
	public String toString(){
		String ret = "label: ";
		ret += label+"\n";
		ret +="TFTimes: "+tfs;
		return ret;
	}
}